﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using ElGee.Google.Charts;

namespace WebApp
{
    public static class PieChartData
    {
        /// <summary>
        /// Gets the data source for a PieChart.
        /// </summary>
        /// <returns></returns>
        public static ChartDataSource GetDataSource()
        {
            var ds = new ChartDataSource();

            ChartDataTable dt = new ChartDataTable(TypeOfAxis.Horizontal, TypeOfColumn.String, "Values");
            dt.Data.Add("Europe");
            dt.Data.Add("Africa");
            dt.Data.Add("Asia");
            dt.Data.Add("America");
            ds.Tables.Add(dt);

            dt = new ChartDataTable(TypeOfAxis.Vertical, TypeOfColumn.Number, "Data");
            dt.Data.Add("51");
            dt.Data.Add("41");
            dt.Data.Add("12");
            dt.Data.Add("101");
            ds.Tables.Add(dt);

            return ds;
        }

        public static PieChart GetOptions()
        {
            var chart = new PieChart();
            chart.Style.Title = "2010 Sales repartition";
            chart.Style.Height = 300;
            chart.Style.Width = 400;
            chart.Style.is3D = true;
            return chart;
        }
    }
}